// 禁用WebSocket连接的自定义服务脚本
const { createServer } = require('http');
const express = require('express');
const { createProxyMiddleware } = require('http-proxy-middleware');
const path = require('path');
const fs = require('fs');

// 创建Express应用
const app = express();

// 代理配置
const proxyConfig = {
  target: 'http://localhost:4041',
  changeOrigin: true
};

// 为所有非静态资源请求设置代理
app.use('/', createProxyMiddleware(proxyConfig));

// 启动服务器
const PORT = 8081;
const server = createServer(app);

server.listen(PORT, 'localhost', () => {
  console.log(`\n服务器已启动，访问地址: http://localhost:${PORT}/\n`);
  console.log('注意：此开发服务器已禁用WebSocket和热重载功能\n');
});
